﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Event_SG_EWDT
{
    public partial class dummy_usercontrolaspx : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Dynamically adds controls into page...
            
            //add 5 controls for this example
            for (int i = 0; i < 5; i++)
            {
                Control c = LoadControl("~/CustomUserControl.ascx"); //Please note that you have to point to the ascx file 

                ((Label)c.FindControl("myLabel")).Text = "This is the number " + i.ToString() + "web user control";

                this.Controls.Add(c); //add to this page
            }

        }
    }
}